package cn.xabad.server.thea.ext

import org.joda.time.DateTime

fun DateTime.normal(): String {
    return toString("yyyy-MM-dd HH:mm:ss")
}

fun DateTime.todayStart(): String {
    return toString("yyyy-MM-dd 00:00:00")
}
fun DateTime.todayStartL(): Long {
    return DateTime(year,monthOfYear,dayOfMonth,0,0,0).millis
}
fun DateTime.todayEndL(): Long {
    return DateTime(year,monthOfYear,dayOfMonth,23,59,59).millis
}
fun DateTime.todayEnd(): String {
    return toString("yyyy-MM-dd 23:59:59")
}

fun DateTime.onlyDay(): String {
    return toString("yyyy-MM-dd")
}

fun DateTime.onlyDay(day: Int): String {
    return this.plusDays(day).toString("yyyy-MM-dd")
}

fun DateTime.onlyTime(): String {
    return toString("HH:mm:ss")
}
